// Fill out your copyright notice in the Description page of Project Settings.

#pragma once

#include "CoreMinimal.h"
#include "GameFramework/Character.h"
#include "PetBaseCharacter.generated.h"


UENUM(BlueprintType)
enum class EQualification: uint8
{
	// 普通
	Ordinary UMETA(DisplayName = "普通"),
	// 稀有
	Rare UMETA(DisplayName = "稀有"),
	// 极稀有
	ExtremelyRare UMETA(DisplayName = "极稀有"),
	// 罕见
	Uncommon UMETA(DisplayName = "罕见"),
	// 神兽
	MythicalBeast UMETA(DisplayName = "神兽"),
};


UCLASS()
class SSHOOT_API APetBaseCharacter : public ACharacter
{
	GENERATED_BODY()

public:
	// Sets default values for this character's properties
	APetBaseCharacter();

	// 宠物名称
	UPROPERTY(VisibleAnywhere,BlueprintReadWrite,Category="petInfo")
	FString Name;
	// 宠物头像
	UPROPERTY(VisibleAnywhere,BlueprintReadWrite,Category="petInfo")
	TObjectPtr<UMaterial> Head;
	
	// 等级
	UPROPERTY(VisibleAnywhere,BlueprintReadWrite,Category="property")
	int LV;
	
	// 血量
	UPROPERTY(VisibleAnywhere,BlueprintReadWrite,Category="property")
	int Health;

	// 当前血量
	UPROPERTY(VisibleAnywhere,BlueprintReadWrite,Category="property")
	int CurrentHealth;
	
	// 攻击力
	UPROPERTY(VisibleAnywhere,BlueprintReadWrite,Category="property")
	int AttackPower;
	
	// 防御
	UPROPERTY(VisibleAnywhere,BlueprintReadWrite,Category="property")
	int Defense;
	
	// 资质
	UPROPERTY(VisibleAnywhere,BlueprintReadWrite,Category="property")
	EQualification QualificationAttr;
	
	// 好感度
	UPROPERTY(VisibleAnywhere,BlueprintReadWrite,Category="property")
	int Favorability;
	
	
	// 饥饿值
	UPROPERTY(VisibleAnywhere,BlueprintReadWrite,Category="property")
	int Hunger;
	
	// 当前饥饿值
	UPROPERTY(VisibleAnywhere,BlueprintReadWrite,Category="property")
	int CurrentHunger;
	
	UPROPERTY(EditAnywhere,BlueprintReadWrite)
	bool IsReset;

	UPROPERTY(EditAnywhere,BlueprintReadWrite)
	TObjectPtr<UAnimMontage> CallMontage;

	bool isRandom = false;

	FLatentActionInfo LatentInfo;
protected:
	// Called when the game starts or when spawned
	virtual void BeginPlay() override;

public:	
	// Called every frame
	virtual void Tick(float DeltaTime) override;

	// Called to bind functionality to input
	virtual void SetupPlayerInputComponent(class UInputComponent* PlayerInputComponent) override;

	/**
	 * @brief 宠物开启休息模式
	 */
	void RestMode();

	void MovePlayAssignLocation();

	UFUNCTION()
	void SetRestTrue()
	{
		IsReset = true;
	}
	void CopyProp(APetBaseCharacter* source);
	/**
	 * @brief 移动到玩家位置
	 */
	void MovePlayPosition();

	void DeliverPlayNearby();

	/**
	 * @brief 随机玩家四周移动
	 */
	void RandomPlayNearbyMoveCheck();

	/**
	 * @brief 随机玩家四周移动
	 */
	UFUNCTION()
	void RandomPlayNearbyMove();
};
